package com.purchase.ml.mapper.sys;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.purchase.ml.entity.sys.SysRolePermission;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
* <p>
    * 角色权限对应关系表 Mapper 接口
    * </p>
*
* @author kyyang
* Created 2021-01-07
*/
    @Mapper
    @Repository
    public interface SysRolePermissionMapper extends BaseMapper<SysRolePermission> {


    List<String> selectByRoleId(@Param("roleId") Integer roleId);


    @Delete("delete from sys_role_permission where roleId = #{id}")
    int deleteByRoleId(@Param("id") Long id);

    @Select("select roleId,permissionId from sys_role_permission where roleId = #{roleId} and permissionId = #{id}")
    SysRolePermission selectByKey(@Param("id") Integer id, @Param("roleId") Integer roleId);
}
